const webpack = require("webpack");
const commonConfig = require("./webpack.common");
const { merge } = require("webpack-merge");

/**
 * @type { import('webpack').Configuration | { devServer: import('webpack-dev-server').Configuration } }
 */
const config = {
  mode: "development",
  devtool: "cheap-module-eval-source-map",
  devServer: {
    // open: true,
    host: "0.0.0.0",
    hotOnly: true,
    // proxy: {
    //   changeOrigin: true,
    //   "^/api": {
    //     target: "https://api.github.com",
    //     pathRewrite: { "^/api": "" },
    //   },
    // },
  },
  plugins: [new webpack.HotModuleReplacementPlugin()],
};

module.exports = merge(commonConfig, config);
